home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 8: LINUX Games
/
Linux Cubed Series 8 - LINUX Games.iso
/
games
/
x11
/
strategy
/
xpuzzles.3
/
xpuzzles
/
xpuzzles-5.3.1
/
xrubik
/
RubikP.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-02-05
|
4KB
|
161 lines
/*
# X-BASED RUBIK'S CUBE(tm)
#
# RubikP.h
#
###
#
# Copyright (c) 1994 - 96 David Albert Bagley, bagleyd@hertz.njit.edu
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and
# that both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of the author not be
# used in advertising or publicity pertaining to distribution of the
# software without specific, written prior permission.
#
# This program is distributed in the hope that it will be "playable",
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
*/
/* Private header file for Rubik */
#ifndef _RubikP_h
#define _RubikP_h
#include "Rubik.h"
/*** random number generator ***/
/* insert your favorite */
extern void SetRNG();
extern long LongRNG();
#define SRAND(X) SetRNG((long) X)
#define LRAND() LongRNG()
#define NRAND(X) ((int)(LRAND()%(X)))
#define SYMBOL ':'
#define IGNORE (-1)
#define TOP 0
#define RIGHT 1
#define BOTTOM 2
#define LEFT 3
#define STRT 4
#define CW 5
#define HALF 6
#define CCW 7
#define MAXORIENT 4
/* The following are in xrubik.c also */
#define MAXFACES 6
#define MINCUBES 1
#define DEFAULTCUBES 3
#define MIN(a,b) (((int)(a)<(int)(b))?(int)(a):(int)(b))
#define MAX(a,b) (((int)(a)>(int)(b))?(int)(a):(int)(b))
typedef struct _RubikLoc
{
int face, rotation;
} RubikLoc;
typedef struct _RubikPart
{
Pixel foreground;
Pixel borderColor;
Pixel faceColor[MAXFACES];
RubikLoc *cubeLoc[MAXFACES];
RubikLoc *faceLoc;
RubikLoc *rowLoc[MAXORIENT];
int currentFace, currentPosition, currentDirection;
Boolean started, practice, orient, vertical, mono;
int dim; /* This allows us to reuse code between 2d and 3d */
int depth;
int size, sizeSize;
Position delta;
Position orientLineLength;
XPoint puzzleSize;
XPoint puzzleOffset, letterOffset;
GC puzzleGC;
GC borderGC;
GC faceGC[MAXFACES];
GC inverseGC;
String faceName[MAXFACES];
XtCallbackList select;
} RubikPart;
typedef struct _RubikRec
{
CorePart core;
RubikPart rubik;
} RubikRec;
/* This gets around C's inability to do inheritance */
typedef struct _RubikClassPart
{
int ignore;
} RubikClassPart;
typedef struct _RubikClassRec
{
CoreClassPart core_class;
RubikClassPart rubik_class;
} RubikClassRec;
typedef struct _RowNext
{
int face, direction, sideFace;
} RowNext;
extern RubikClassRec rubikClassRec;
extern RubikLoc *startLoc[MAXFACES];
extern void QuitRubik();
extern void PracticeRubik();
extern void PracticeRubikMaybe();
extern void RandomizeRubik();
extern void RandomizeRubikMaybe();
extern void GetRubik();
extern void WriteRubik();
extern void UndoRubik();
extern void SolveRubik();
extern void IncrementRubik();
extern void DecrementRubik();
extern void OrientizeRubik();
extern void MoveRubikCw();
extern void MoveRubikCcw();
extern void MoveRubikInput();
extern void MoveRubik();
extern void SelectRubik();
extern void ReleaseRubik();
extern void ResetPolyhedrons();
extern void SolvePolyhedrons();
extern void DrawAllPolyhedrons();
extern Boolean CheckSolved();
extern void InitMoves();
extern void PutMove();
extern void GetMove();
extern int MadeMoves();
extern void FlushMoves();
extern int NumMoves();
extern void ScanMoves();
extern void PrintMoves();
extern void ScanStartPosition();
extern void PrintStartPosition();
extern void SetStartPosition();
#ifdef DEBUG
extern void PrintCube();
extern void PrintFace();
extern void PrintRow();
#endif
#endif /* _RubikP_h */